package com.iss.view.view;

public abstract class Window {
    public Window nextWindow;
    public String cmd = "";

    public abstract String print() ;

    public abstract Window getNextWindow(String cmd);

    private void printTopBorder() {
        System.out.println("# = = =welcome to Ht-酒店管理系统= = = = = = = #");
    }

    private void printBottomBorder() {
        System.out.println("# = = = = = = = = = = = = = = = = =  = = = = = #");
    }

    public String exec()  {
        this.printTopBorder();
        this.cmd = this.print();
        this.printBottomBorder();
        if (this.getNextWindow(this.cmd) != null) {
            this.nextWindow = this.getNextWindow(this.cmd);
            this.cmd = this.nextWindow.exec();
        } else {
            //this.cmd ="I";
        }
        return this.cmd;
    }
}
